<%@ Page Language="C#" MasterPageFile="~/master/public-regular.master" AutoEventWireup="true"
    CodeFile="change-password.aspx.cs" Inherits="myaccount_change_password" %>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolderNestedHeader"
    runat="Server">
</asp:Content>
<asp:Content ID="cntContent" ContentPlaceHolderID="cphMiddleContent" runat="Server">
    <div runat="server" id="divMessage">
        <asp:Literal ID="litMessage" runat="server"></asp:Literal>
    </div>
    <asp:ValidationSummary ID="ValidationSummary1" runat="server" EnableClientScript="true"
        DisplayMode="BulletList" ShowMessageBox="true" HeaderText="Please correct the following:"
        CssClass="adminValidator" ValidationGroup="VGroup" ShowSummary="False" />
    <p>
        <label class="title_text_general_small">
            Email Address</label><br />
        <asp:TextBox ID="tbxEmailAddress" runat="server" CssClass="text"></asp:TextBox>
        <asp:RequiredFieldValidator ID="rfvEmailAddress" runat="server" ControlToValidate="tbxEmailAddress"
            ErrorMessage="E-Mail Address is required" Display="dynamic" SetFocusOnError="true"
            EnableClientScript="true" ValidationGroup="VGroup">
        </asp:RequiredFieldValidator>
        <asp:RegularExpressionValidator runat="server" ID="revEmailAddress" ControlToValidate="tbxEmailAddress"
            EnableClientScript="true" ErrorMessage="Incorrect Email Format" SetFocusOnError="true"
            ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" ValidationGroup="VGroup">
        </asp:RegularExpressionValidator>
        <br />
        <label class="title_text_general_small">
            Present Password</label><br />
        <asp:TextBox ID="tbxCurrentPassword" runat="server" TextMode="password" CssClass="text"></asp:TextBox>
        <asp:RequiredFieldValidator ID="rfvCurrentPassword" runat="server" ControlToValidate="tbxCurrentPassword"
            ErrorMessage="Password is required" Display="dynamic" SetFocusOnError="true"
            EnableClientScript="true" ValidationGroup="VGroup">
        </asp:RequiredFieldValidator>
        <br />
        <label class="title_text_general_small">
            New Password</label><br />
        <asp:TextBox ID="tbxNewPassword" runat="server" TextMode="password" CssClass="text"></asp:TextBox>
        <asp:RequiredFieldValidator ID="rfvNewPassword" runat="server" ControlToValidate="tbxNewPassword"
            ErrorMessage="New Password is required" Display="dynamic" SetFocusOnError="true"
            EnableClientScript="true" ValidationGroup="VGroup">
        </asp:RequiredFieldValidator>
        <asp:RegularExpressionValidator runat="server" ID="revNewPassword" ControlToValidate="tbxNewPassword"
            EnableClientScript="true" ErrorMessage="Invalid Password Length" SetFocusOnError="true"
            ValidationExpression="^[a-zA-Z0-9]{6,50}$" ValidationGroup="VGroup">
        </asp:RegularExpressionValidator>
        <br />
        <label class="title_text_general_small">
            Confirm Password</label><br />
        <asp:TextBox ID="tbxConfirmPassword" runat="server" TextMode="password" CssClass="text"></asp:TextBox>
        <asp:RequiredFieldValidator ID="rfvPasswordConfirm" runat="server" ControlToValidate="tbxConfirmPassword"
            ErrorMessage="Login Confirm Password is required" Display="dynamic" SetFocusOnError="true"
            EnableClientScript="true" ValidationGroup="VGroup">
        </asp:RequiredFieldValidator>
        <asp:CompareValidator ID="cvConfirmPassword" runat="server" ErrorMessage="Confirm Password does not match"
            ControlToValidate="tbxConfirmPassword" ControlToCompare="tbxNewPassword" ValidationGroup="VGroup"
            EnableClientScript="true" Operator="Equal" Type="String" SetFocusOnError="true">
        </asp:CompareValidator>
    </p>
    <asp:Button ID="imbModify" CssClass="button medium white" Text="Modify" runat="server"
        AlternateText="Modify" CausesValidation="true" OnClick="imbModify_Click" ValidationGroup="VGroup" />
    <asp:Button ID="imbReset" runat="server" CssClass="button medium gray" Text="Reset"
        AlternateText="Reset" CausesValidation="false" OnClientClick="javascript:ResetFields();return false;" />
    <script language="javascript" type="text/javascript">
        function ResetFields() {
            $('<%= tbxEmailAddress.ClientID %>').value = '';
            $('<%= tbxCurrentPassword.ClientID %>').value = '';
            $('<%= tbxNewPassword.ClientID %>').value = '';
            $('<%= tbxConfirmPassword.ClientID %>').value = '';
        }               
    </script>
</asp:Content>
